﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core.Utils;

namespace COFE.Core
{
    public class MetadataFilter : IPropertyFilter
    {
        #region Constructor

        public MetadataFilter(bool majorProperty)
        {
            _majorProperty = majorProperty;
        }

        public MetadataFilter()
        {

        }

        #endregion

        #region Methods

        public bool Match(object property)
        {
            var ma = MetadataExtension.getMetadata(property);
            if (ma != null)
            {
                if (_majorProperty.HasValue)
                    if (ma.MajorProperty != _majorProperty.Value)
                        return false;
                return true;
            }
            return false;
        }

        #endregion

        #region Data

        private bool? _majorProperty;        

        #endregion

        #region Public Properties

        #endregion
    }
}
